<template>
  <div class="device-table">
    <el-table :data="tableData" style="width: 100%" height="90%">
      <el-table-column prop="deviceId" label="设备编码"> </el-table-column>
      <el-table-column prop="deviceName" label="设备名称"> </el-table-column>
      <el-table-column prop="deviceHealth" label="设备健康度">
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="100">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small"
            >查看详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background layout="prev, pager, next" :total="100">
    </el-pagination>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      tableData: [
        {
          deviceId: "0502",
          deviceName: "王小虎",
          deviceHealth: 80,
        },
        {
          deviceId: "0504",
          deviceName: "王小虎",
          deviceHealth: 80,
        },
        {
          deviceId: "0501",
          deviceName: "王小虎",
          deviceHealth: 80,
        },
        {
          deviceId: "0503",
          deviceName: "王小虎",
          deviceHealth: 80,
        },
      ],
    };
  },
  mounted() {},
  created() {},
  methods: {
    // 表格查看详情按钮处理函数
    handleClick(row) {
      console.log(row.deviceId);
      this.$router.push({
        name: "/single_device",
        params: { deviceId: row.deviceId },
      });
    },
  },
};
</script>

<style scoped>
.device-table {
  position: relative;
  width: 100%;
  height: 100%;
}
.el-pagination {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 0;
}
</style>